#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QToolBar>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QToolBar* toolBar = new QToolBar();
    toolBar->setFloatable(true);

    toolBar->setAllowedAreas(Qt::LeftToolBarArea|Qt::RightToolBarArea);
    this->addToolBar(toolBar);
    QIcon icon1(":/open.png");
    QIcon icon2(":/save.png");
    QAction* action1 = new QAction(toolBar);
    action1->setText("打开");
    //QAction* actionChild = new QAction(action1);
    //action1->addAction(actionChild);
    action1->setIcon(icon1);
    QAction* action2 = new QAction(toolBar);
    action2->setText("保存");
    action2->setIcon(icon2);
    toolBar->addAction(action1);
    toolBar->addAction(action2);
}

MainWindow::~MainWindow()
{
    delete ui;
}

